home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 14 / CU Amiga Magazine's Super CD-ROM 14 (1997)(EMAP Images)(GB)(Track 1 of 3)[!][issue 1997-09].iso / CUCD / Programming / IEditor / Varie / iconstartup.i < prev    next >
Encoding:
Text File  |  1997-06-17  |  699 b   |  33 lines

  1.     include dos/dosextens.i
  2.  
  3.     movem.l    d0/a0,-(sp)
  4.     sub.l a1,a1
  5.     move.l  4,a6
  6.     jsr    _LVOFindTask(a6)
  7.     move.l    d0,a4
  8.     tst.l pr_CLI(a4)    ; was it called from CLI?
  9.     bne.s   fromCLI        ; if so, skip out this bit...
  10.     lea    pr_MsgPort(a4),a0
  11.     move.l  4,a6
  12.     jsr    _LVOWaitPort(A6)
  13.     lea    pr_MsgPort(a4),a0
  14.     jsr    _LVOGetMsg(A6)
  15.     move.l    d0,returnMsg
  16. fromCLI
  17.     movem.l    (sp)+,d0/a0
  18. go_program
  19.     bsr.s _main                 ; Calls your code..
  20.     move.l    d0,-(sp)
  21.     tst.l returnMsg        ; Is there a message?
  22.     beq.s exitToDOS        ; if not, skip...
  23.     move.l    4,a6
  24.           jsr _LVOForbid(a6)             ; note! No Permit needed!
  25.     move.l    returnMsg(pc),a1
  26.     jsr    _LVOReplyMsg(a6)
  27. exitToDOS
  28.     move.l    (sp)+,d0     ; exit code
  29.     rts
  30. returnMsg dc.l 0
  31.     even                ;(or cnop 0,2)
  32. _main
  33.